ACTIONS


These commands determine how the parts of the filename that have been selected with selectors will be modified.
If no selectors have been given then the whole filename will be modified. Only one action can be given for each group of selectors.

TO
INSERT
DELETE
UPPER

LOWER
TOGGLECASE


Component actions:

The following actions are called component actions because they target the entire prefix, main and suffix components of the filename and can't modify any smaller filename segments. More than one can be used at the same time.

SWAP

LSHIFT
RSHIFT
CONV8+3
UNIFY


Action options:

The following options can redirect the result of the modification to the filename or the comment or to both.

TOFILENAME
TOCOMMENT








TO (AS)
<[path/]filename> :

Secondary arguments:

SAMEPATH (SP)

Replaces the selected portion of the filename with the given string. It can also be used to move files to other directories in the same volume if a path is supplied. To perform simple renaming like with the OS rename command you can ommit giving 'TO' in the command line and give just the old and new filenames.
TO can also accept empty strings (""). In this case the filename is left unchanged but the file will be moved to the current directory if it is in the same volume as the file.
To obtain compatibility with the OS Rename command the source path isn't used as the destination path if no destination path is given, as was done in previous versions.
If you want to reuse the source path as the destination path then the SAMEPATH secondary argument must be given. SAMEPATH is ignored if any path is given with TO.
The TO action can also be used in the numbering of filenames and to perform conversions, see the numbering section and the conversion section respectively for details.


Examples:

> SRename OldFileName L 3 TO New
output:
"OldFileName" renamed as "NewFileName"

> SRename TestFile NewDir/ : Moves "TestFile" to "NewDir".

> SRename TestFile NewDir/NewName : Moves "TestFile" to "NewDir" and
renames it as "NewName".

> SRename TestFile "" : Moves "TestFile" to the current directory.

> SRename Pics/Raytraced TO Rendered : The file will be renamed but will also be moved to the current directory.

> SRename Pics/Raytraced TO Rendered SP : Now the file does not move to the current directory but stays at the "Pics" directory even though no destination path is given.




INSERT (NS) <string> :


Secondary arguments:

AT <value>

APPEND (AP)
EXIST (EX)

CASESENS (CS)

Inserts the given string anywhere in the selected characters. The position of the characters can be set with the AT secondary argument. If the value given with AT is negative then the position is measured from the end of the selected characters. If AT is not given the given string is simply inserted at the beginning of the selected characters.

The APPEND secondary argument can be used to indicate that the given string is going to be appended to the selected characters rather than inserted to them. Here is an example to clarify exactly what APPEND does:
With "NS abc AT 4" the string "abc" is placed before the 4th character of the filename.
With "NS abc AT 4 AP" the string "abc" is placed after the 4th character of the filename.

If APPEND is given without using AT then the given string is simply appended to the end of the selected characters.

Furthermore the EXIST secondary argument can be used to allow the insertion only if the characters to insert don't already exist at the given position. When EXIST is given the characters that are compared with the string to insert are at the specified position when giving positive values to AT, and before the specified position when giving it negative values. This comparison is not case sensitive by default but this can be changed with the CASESENS secondary argument.
The TO action can also be used for the numbering of filenames, see the numbering section for details.

Examples:

> SRename Letter.txt NS First : Inserts the string "First" at the filename
output:
"Letter.txt" renamed as "FirstLetter.txt"

> SRename AnyFilename NS XYZ AT 4 : Inserts the string "XYZ" at the 4th character of the filename
output:
"AnyFilename" renamed as "AnyXYZFilename"

> SRename Sound NS Sample AP : Appends the string "Sample" to the filename.
output:
"Sound" renamed as "SoundSample"

> SRename old_letter.txt NS Old EX : Because "old" already exists in the beginning of the filename it is not inserted.
output:
"old_letter.txt" not changed

> SRename old_letter.txt NS Old EX CS : Now "Old" is inserted because the comparison is case sensitive.
output:
"old_letter.txt" renamed as "Oldold_letter.txt"

> SRename pic_last.iff NS Last AT -5 EX : Trying to insert "last" in the 5th character from the end fails because it already exists.
output:
"pic_last.iff" not changed




DELETE (DL) :



Removes the selected characters from the filename.

Examples:

> SRename #? L 3 DL : Deletes the first 3 characters from all filenames.

> SRename #? SU DL : Deletes the suffix from all filenames.

> SRename #? MT /:/$#@ DL : Deletes every "$", "#" and "@" character from filenames.




UPPER (UP) :



Makes the selected characters uppercase.

Examples:

> SRename #? L 1 UP : Makes uppercase the first character of every filename.

> SRename #? SU UP : Makes uppercase only the suffix of every filename.




LOWER (LW) :



Makes the selected characters lowercase.

Example:

> SRename TEXTFILE LW
output:
"TEXTFILE" renamed as "textfile"




TOGGLECASE (TG) :



Makes the uppercase selected characters lowercase and the lowercase selected characters uppercase.

Example:

>SRename StUpIdCaSiNg TG
output:
"StUpIdCaSiNg" renamed as "sTuPiDcAsInG"







Component actions




SWAP (SW) :


Swaps the selected filename components. If 2 of the PREFIX, MAIN, SUFFIX selectors are given, then the parts specified by these selectors will be swapped. Otherwise if none of the above selectors are given or all of them,
then just the 2 extreme components are swapped.
SWAP has an effect only on filenames with at least 2 components, like prefix-main, main-suffix, or all (prefix-main-suffix).

Examples:

> SRename picture.iff SW
output:
"picture.iff" renamed as "iff.picture"

> SRename 001.picture.iff SW
output:
"001.picture.iff" renamed as "iff.picture.001"

> SRename 001.picture.iff PR MA SW
output:
"001.picture.iff" renamed as "picture.001.iff"




LSHIFT (LS) :



Shifts the filename components to the left, the leftmost becomes the rightmost. Like SWAP it has an effect only on filenames with at least 2 components. This keyword operates on the whole filename so the component selectors have no effect with it.

Example:

> SRename 001.picture.iff LS
output:
"001.picture.iff" renamed as "picture.iff.001"




RSHIFT (RS) :



Shifts the filename components to the right, the rightmost becomes the leftmost. It has an effect only on filenames with at least 2 components. Like LSHIFT it also operates on the whole filename so the component selectors have no effect with it.

Example:

> SRename 001.picture.iff RS
output:
"001.picture.iff" renamed as "iff.001.picture"




CONV8+3 (8+3) :



Converts filenames to the MS DOS format of 8+3 characters. The filename will be made uppercase, if it has a suffix this will be cut to 3 characters in length, and if it has a prefix it will only be maintained if there is room left from the main component.
Note that none of the selector keywords have any effect with this keyword because it always operates on the whole filename. It is possible when converting whole directories that some filenames will fail to be converted because they may get the same name with other files.
For example picture-1.iff and picture-2.iff will both receive the name: PICTURE-.IFF

Examples:

> SRename User.prefs 8+3
output:
"User.prefs" renamed as "USER.PRE"

> SRename sound.sample.iff 8+3
output:
"sound.sample.iff" renamed as "S_SAMPLE.IFF"




UNIFY (UN) <PMS>:


Unifies the filename components specified by the P, M, or S characters that must be given after it, P meaning prefix, M main and S suffix. These characters can be given in any order.
Note that unifying the main part is a little different than unifying the prefix or suffix. Unifying the prefix or suffix causes the separator between them and the main part to be deleted, whereas unifying the main part will remove from it any separator characters that it main contain.

Examples:

> SRename picture.001 UN PMS
output:
"picture.001" renamed as "picture001"

> SRename 001.picture.iff UN P
output:
"001.picture.iff" renamed as "001picture.iff"

> SRename 001.some.complex.name.iff UN M
output:
"001.some.complex.name.iff" renamed as "001.somecomplexname.iff"







Action options



TOFILENAME (TF) :


This option causes the modified or unmodified comment to be redirected to the filename. If the user wants the current comment to be modified as well as the filename with the same action, then the TOCOMMENT option must also be given.
If a filename's comment contains characters that denote a path then only the filename part of the comment will go to the filename.

Examples:

> SRename sample.iff CO TF : "sample.iff" will be renamed as it's comment.
output:
"sample.iff" renamed as "created with SFX"

> SRename sample.iff CO UP TF TC : Makes the comment of "sample.iff" uppercase and will also use it to rename "sample.iff".
output:
Comment of "sample.iff" changed from "created with SFX" to "CREATED WITH SFX"
"sample.iff" renamed as "CREATED WITH SFX"




TOCOMMENT (TC) :



This option causes the modified or unmodified filename to be redirected to the comment. If the user wants the filename to be modified as well as the comment with the same action, then the TOFILENAME option must also be given.

Note that when both the filename and comment are modified and the ICONS option is given then only the filenames of icons are modified and not their comments. Files other than icons will get both their filename and comment modified in such a case.

Examples:

> SRename brush1.bsh SU TO iff TF TC : Puts "iff" to the filename suffix and also copies the new filename to the comment.
output:
Comment of "brush1.bsh" changed from "" to "brush1.iff"
"brush1.bsh" renamed as "brush1.iff"

> SRename brush1.bsh TC : Copies the filename to the comment.
output:
Comment of "brush1.bsh" changed from "" to "brush1.bsh"

> SRename a#? IC TC UP : Here the unmodified filename goes to the comment and then the filename is made uppercase. The TOFILENAME option doesn't have to be given here for the filename to be modified, because the action that is given after TC (UP) implies that the filename is modified and the result goes by default to the filename.
Also note that as both the filenames and comments are modified, the comment of the icons are not modified.
output:

Comment of "Airport.jpg" changed from "" to "Airport.jpg"
"Airport.jpg" renamed as "AIRPORT.JPG"
"Airport.jpg.info" renamed as "AIRPORT.JPG.info"
Comment of "Avenger.jpg" changed from "" to "Avenger.jpg"
"Avenger.jpg" renamed as "AVENGER.JPG"
"Avenger.jpg.info" renamed as "AVENGER.JPG.info"
Comment of "Alpha jet.jpg" changed from "" to "Alpha jet.jpg"
"Alpha jet.jpg" renamed as "ALPHA JET.JPG"
"Alpha jet.jpg.info" renamed as "ALPHA JET.JPG.info"
Comment of "Albatros.jpg" changed from "" to "Albatros.jpg"
"Albatros.jpg" renamed as "ALBATROS.JPG"
"Albatros.jpg.info" renamed as "ALBATROS.JPG.info"